package backend;

import gui.Shortcut;

import java.io.*;

public class FileIO {
	public static void main(String[] args) {
		String text = loadFile("C:/Workspace/Shortcut Utility/Help.html");
		System.out.println(text);
	}

	public static String loadFile(String fileName) {
		if ((fileName == null) || (fileName == ""))
			throw new IllegalArgumentException();

		String line;
		String text = new String();
		try {
			File file = new File(fileName);
			BufferedReader in = new BufferedReader(new FileReader(file));
			if (!in.ready())
				throw new IOException();
			while ((line = in.readLine()) != null)
				text = text + line + "\n";
			in.close();
		} catch (IOException e) {
			System.out.println(e);
			return null;
		}
		return text;
	}
	public static void deleteFile(Shortcut shortcut){
		File file = new File(shortcut.getExecPath());
		file.delete();
		
	}
	
}